/*
 * Do not introduce any breaking changes to this API.
 * This is the public API for other extensions to interact with this extension.
 */

import { Event, Uri } from "vscode";
import { Resource } from "./common/types";
import { EnvPathType } from "./eqEnvironments/base/info";

export interface IExtensionApi {
    ready: Promise<void>;
    jupyter: {
        registerHooks(): void;
    };
    debug: {
        getRemoteLauncherCommand(host: string, port: number, waitUntilDebuggerAttaches: boolean): Promise<string[]>;
        getDebuggerPackagePath(): Promise<string | undefined>;
    };
    settings: {
        readonly onDidChangeExecutionDetails: Event<Uri | undefined>;
        getExecutionDetails(
            resource?: Resource,
        ): {
            execCommand: string[] | undefined;
        }
    }
    datascience: {
        // showDataViewer(dataProvider: IDataViewerDataProvider, title: string): Promise<void>;
        // registerRemoteServerProvider(serverProvider: IJupyterUriProvider): void;
    };
}

export interface IProposedExtensionAPI {
    environment: {
        readonly onDidChangeExecutionDetails: Event<Uri | undefined>;
        getExecutionDetails(
            resource?: Resource,
        ): Promise<{
            execCommand: string[] | undefined;
        }>;
        getActiveEnvironmentPath(resource?: Resource): Promise<EnvPathType | undefined>;
        // getEnvironmentDetails(
        //     path: string,
        //     options?: EnvironmentDetailsOptions,
        // ): Promise<EnvironmentDetails | undefined>;
        getEnvironmentPaths(): Promise<EnvPathType[] | undefined>;
        setActiveEnvironment(path: string, resource?: Resource): Promise<void>;
        // refreshEnvironment(options?: RefreshEnvironmentsOptions): Promise<EnvPathType[] | undefined>;
        getRefreshPromise(): Promise<void> | undefined;
        onDidEnvironmentsChanged: Event<EnvironmentsChangedParams[]>;
        onDidActiveEnvironmentChanged: Event<ActiveEnvironmentChangedParams>;
    };
}
export interface EnvironmentsChangedParams {
    /**
     * Path to environment folder or path to interpreter that uniquely identifies an environment.
     * Virtual environments lacking an interpreter are identified by environment folder paths,
     * whereas other envs can be identified using interpreter path.
     */
    path?: string;
    type: 'add' | 'remove' | 'update' | 'clear-all';
}
export interface ActiveEnvironmentChangedParams {
    /**
     * Path to environment folder or path to interpreter that uniquely identifies an environment.
     * Virtual environments lacking an interpreter are identified by environment folder paths,
     * whereas other envs can be identified using interpreter path.
     */
    path: string;
    resource?: Uri;
}